﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;

namespace Remind.View
{
    public partial class frmChangePwd : Form
    {
        public frmChangePwd()
        {
            InitializeComponent();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            //检查原始密码
            string oldpwd=ConfigurationManager.AppSettings["admin"];
            string old=FrmPws.Jiami(txtOld.Text);

            if (oldpwd == old)
            {
                string xin=txtOk.Text;
                string xinq=txtNew.Text;
                if (xin == xinq)
                {
                    xin = FrmPws.Jiami(xinq);
                    FrmPws.SetValue("admin", xin);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("新密码与确认密码不一致，请重新输入！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtOk.Text = "";
                    txtOk.Focus();
                }
            }
            else
            {
                MessageBox.Show("原始密码错误，如果忘记请联系洋芋！","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
                txtOld.Text = "";
                txtOld.Focus();
            }
        }
    }
}
